home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / misc / rotate_tex.sty < prev    next >
Text File  |  1992-06-11  |  2KB  |  46 lines

  1. %% Save file as: ROTATE.TEX                     Source: FILESERV@SHSU.BITNET
  2. %% NOTE: This file is part of the DVIPS distribution
  3. %
  4. %   These macros allow you to rotate or flip a \TeX\ box.  Very useful for
  5. %   sideways tables or upsidedown answers.
  6. %
  7. %   To use, create a box containing the information you want to rotate.
  8. %   (An hbox or vbox will do.)  Now call \rotr\boxnum to rotate the
  9. %   material and create a new box with the appropriate (flipped) dimensions.
  10. %   \rotr rotates right, \rotl rotates left, \rotu turns upside down, and
  11. %   \rotf flips.  These boxes may contain other rotated boxes.
  12. %
  13. \newdimen\rotdimen
  14. \def\vspec#1{\special{ps:#1}}%  passes #1 verbatim to the output
  15. \def\rotstart#1{\vspec{gsave currentpoint currentpoint translate
  16.    #1 neg exch neg exch translate}}% #1 can be any origin-fixing transformation
  17. \def\rotfinish{\vspec{currentpoint grestore moveto}}% gets back in synch
  18. %
  19. %   First, the rotation right. The reference point of the rotated box
  20. %   is the lower right corner of the original box.
  21. %
  22. \def\rotr#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  23.    \hbox to\rotdimen{\hskip\ht#1\vbox to\wd#1{\rotstart{90 rotate}%
  24.    \box#1\vss}\hss}\rotfinish}
  25. %
  26. %   Next, the rotation left. The reference point of the rotated box
  27. %   is the upper left corner of the original box.
  28. %
  29. \def\rotl#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  30.    \hbox to\rotdimen{\vbox to\wd#1{\vskip\wd#1\rotstart{270 rotate}%
  31.    \box#1\vss}\hss}\rotfinish}%
  32. %
  33. %   Upside down is simple. The reference point of the rotated box
  34. %   is the upper right corner of the original box. (The box's height
  35. %   should be the current font's xheight, \fontdimen5\font,
  36. %   if you want that xheight to be at the baseline after rotation.)
  37. %
  38. \def\rotu#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  39.    \hbox to\wd#1{\hskip\wd#1\vbox to\rotdimen{\vskip\rotdimen
  40.    \rotstart{-1 dup scale}\box#1\vss}\hss}\rotfinish}%
  41. %
  42. %   And flipped end for end is pretty ysae too. We retain the baseline.
  43. %
  44. \def\rotf#1{\hbox to\wd#1{\hskip\wd#1\rotstart{-1 1 scale}%
  45.    \box#1\hss}\rotfinish}%
  46.